package com.weishi.project.training.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weishi.project.api.vo.*;
import com.weishi.project.sport.home.vo.ClassifiedTotalVO;
import com.weishi.project.sport.home.vo.GetLandGlidingSumVO;
import com.weishi.project.sport.home.vo.ThisWeekTrainingDataVO;
import com.weishi.project.sport.movement.vo.ReturnTrainingDayVO;
import com.weishi.project.training.domain.TrainingDay;
import com.weishi.project.training.domain.TrainingWeek;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * trainingDayMapper接口
 */
public interface TrainingDayMapper extends BaseMapper<TrainingDay> {

    /**
     * 查询trainingDay列表
     */
    List<TrainingDay> selectTrainingDayList(TrainingDay trainingDay);

    List<TrainingWeek> getWeekName();

    TrainingDay getTrainingDayById(int id);

    void updateTrainingWeekById(TrainingDay trainingDay);

    @Select("SELECT * FROM `tbl_training_day` t1\n" +
            "LEFT JOIN `tbl_training_week` t2  ON t1.`week_id` = t2.id\n" +
            "LEFT JOIN `tbl_annual_plan` t3 ON t2.`annual_plan_id` = t3.id\n" +
            "WHERE t3.`natural_year_id` = #{naturalYearId}")
    List<TrainingDay> selectTrainingDayListByNaturalYearId(@Param("naturalYearId") Integer naturalYearId);

    List<Map<String, Object>> selectWeekTrainingData(WeekTrainingCompletionVo weekTrainingCompletionVo);

    List<Map<String, Object>> selectWeekTrainingAchievementCompletion(WeekTrainingCompletionVo weekTrainingCompletionVo);

    List<TrainingDay> selectTrainingDayListByDay(String day);

    List<Map<String,Object>> waterSpecialPromotion(WaterSpecialPromotionVo waterSpecialPromotionVo);

    List<TrainingDay> selectTrainingDayBeforedawn(String day);

    List<TrainingDay> selectTrainingDayMorning(String day);

    List<TrainingDay> selectTrainingDayAfternoon(String day);

    List<TrainingDay> selectTrainingDayNight(String day);

    /**
     * 根据四时和一级项目和day日期查询trainingDayId
     * @param map
     * @return
     */
    int getIdByFourSeasonsAndFirstLevelAndDay(Map<String,Object> map);

    int getIdByWeekIdAndDay(Map<String,Object> map);

    /**
     *首页 折线图
     * @return
     */
    List<TrainingDayDetailsVo> getTrainingDayListDetails(TrainingDayDetailsVo trainingDayDetailsVo);

    List<TrainingDayWeekOrDayVo> getTrainingDayWeekOrDayVo(Map<String,Object> params);

    List<TrainingDayKilometerWeekOrDayVo> getTrainingDayKilometerWeekOrDayVo(Map<String,Object> params);

    List<TrainingDaySecondLevelHourWeekOrDayVo> getTrainingDaySecondLevelHourWeekOrDayVo(Map<String,Object> params);

    List<TrainingDayKilometerSecondLevelWeekOrDayVo> getTrainingDayKilometerSecondLevelWeekOrDayVo(Map<String,Object> params);


    /**
     * 训练数据查询运动员训练距离
     */
    Integer getDistance(Integer sportsmanId);


    /**
     * 训练数据查询运动员训练 水上训练次数
     */
    Integer getWaterFrequency(Integer sportsmanId);


    /**
     * 训练数据查询运动员训练 陆上训练次数
     */
    Integer getLandNumber(Integer sportsmanId);


    /**
     * 查询运动员身体准备训练--根据传参-年-查询所有月的统计 ( 按照 分钟 统计 )
     */
    Double getPrepareMonth(Integer userId , String years , List<String> dayList);


    /**
     * 查询返回值  一年中 二级科目的时间占比
     */
    Double getReturnLevelTwoVO(Integer userId , String years , String ballGames , List<String> dayList);


    /**
     * 根据年 来统计 运动员身体准备训练时间 二级科目 所占的百分比
     */
    Integer getStringVO(Integer userId, String years , String ballGames , List<String> dayList);


    void updateKilometersById(TrainingDay trainingDay);


    /**
     * 水上专项训练 训练距离 滑行时长 统计
     */
    Double returnMonthVO(String year , Integer userId ,Integer trainingMode , List<String> dayList);


    /**
     * 水上专项训练 训练时间 滑行距离 统计
     */
    Double returnMonthTimeVO(String year , Integer userId ,Integer trainingMode , List<String> dayList);


    /**
     * 运动员 -- 本周训练数据
     */
    List<ThisWeekTrainingDataVO> getThisWeekTrainingDataVO(String day);


    /**
     * 运动员 -- 根据训练分类查询总计
     */
    List<ClassifiedTotalVO> getClassifiedTotal(@Param("day")String day , @Param("userId")Integer userId);


    /**
     * 运动员 -- 首页 --根据年查询各科训练时间占比
     * 查询除了 水上专项训练和陆上专项训练的其它数据
     */
    List<ClassifiedTotalVO> getClassifiedTotalTwo(@Param("day")String day);


    /**
     * 运动员 -- 首页 -- 陆上专项滑行统计 Sum
     */
    List<GetLandGlidingSumVO> getLandGlidingSum(@Param("year")String year , @Param("userId")Integer userId , @Param("trainingMode")Integer trainingMode , @Param("dayList")List<String> dayList);


    /**
     * 运动员端--查询运动计划详情
     */
    List<ReturnTrainingDayVO> getSportsPlanDetails(@Param("userId")Integer userId , @Param("id")Integer id);


    /**
     * 运动员端--查询运动--乳酸
     */
    List<String> getLacticAcid(@Param("userId")Integer userId , @Param("firstLevel")String firstLevel , @Param("trainingMode")Integer trainingMode , @Param("groupId")Integer groupId , @Param("trainingDayId")Integer trainingDayId);


    /**
     * 运动员端--查询运动--专项成绩信息
     */
    List<ReturnTrainingDayVO> getWaterInformation(@Param("userId")Integer userId , @Param("id")Integer id , @Param("trainingMode")Integer trainingMode , @Param("firstLevel")String firstLevel , @Param("groupId")Integer groupId);


    /**
     * 查询运动员专项最好成绩
     */
    String getPersonalBest(@Param("boatType")String boatType , @Param("idealKilometers")Integer idealKilometers , @Param("userId")Integer userId , @Param("trainingMode")Integer trainingMode , @Param("firstLevel")String firstLevel);


    /**
     * 运动员端--查询运动计划详情第二次查询
     */
    List<ReturnTrainingDayVO> getSportsPlanDetailsTwo(@Param("id")Integer id , @Param("userId")Integer userId);








}